package com.anpy.security.context;

/**
 * u5e73u53f0u4e0au4e0bu6587u6301u6709u8005
 * u7528u4e8eu5b58u50a8u548cu83b7u53d6u5f53u524du8bf7u6c42u7684u5e73u53f0u4ee3u7801
 */
public class PlatformContextHolder {
    
    private static final ThreadLocal<String> CONTEXT = new ThreadLocal<>();
    
    /**
     * u8bbeu7f6eu5f53u524du5e73u53f0u4ee3u7801
     * 
     * @param platformCode u5e73u53f0u4ee3u7801
     */
    public static void setPlatformCode(String platformCode) {
        CONTEXT.set(platformCode);
    }
    
    /**
     * u83b7u53d6u5f53u524du5e73u53f0u4ee3u7801
     * 
     * @return u5e73u53f0u4ee3u7801uff0cu5982u679cu672au8bbeu7f6eu5219u8fd4u56denull
     */
    public static String getPlatformCode() {
        return CONTEXT.get();
    }
    
    /**
     * u6e05u9664u5f53u524du5e73u53f0u4ee3u7801
     */
    public static void clear() {
        CONTEXT.remove();
    }
}
